
import { useSearchParams, useParams } from 'react-router-dom'

const Article = () => {

  // 获取查询参数的方法 [
  const [searchParams] = useSearchParams()

  const id = searchParams.get('id')
  const name = searchParams.get('name')
  const age = searchParams.get('age')

  console.log(id, 'id');
  console.log(name, 'name');
  console.log(age, 'age');
  // ]

  // 获取动态（路由）参数的方法 [
  const params = useParams()
  console.log(params, 'params'); // { id: 1, name: 'zs' }
  console.log(params.id, 'id');
  console.log(params.name, 'name');
  // ]

  return (
    <>
      <div>文章详情页面</div>
    </>
  )
}

export default Article